package distanceBetweenBusStops;

public class Solution {
    public int distanceBetweenBusStops(int[] distance, int start, int destination) {
        // 思路 正向行驶和逆向行驶
        int n = distance.length;
        int rDis = 0;
        for (int i = start; i%n!=destination ; i++) {
            rDis+=distance[i%n];
        }
        int lDis = 0;
        for (int i = destination; i %n!=start ; i++) {
            lDis+=distance[i%n];
        }
        return Math.min(rDis,lDis);
    }
}
